#include <iostream>
#include <cmath>
#include <vector>
#include <functional>
#include "hermite_interpolation.hpp"

int main(){
  std::vector<double> x = {0,3,5,8,13};
  std::vector<double> y = {0,225,383,623,993};
  std::vector<double> dy = {75,77,80,74,72};

  HermiteInterpolation f_her = HermiteInterpolation(x,y,dy);
  
  std::cout << "distant at 10 is " << f_her.interpolate(10) << std::endl;

  //use secant to approximate tangent
  //use discrete point velocity to approximate continuous velocity

  double t = 0;
  double v;
  bool flag = 1;
  while(t < 10){
    v = (f_her.interpolate(t + 0.1) - f_her.interpolate(t))*10;
    if (v > 81){
      std::cout << "over speed at "<< t << " with speed "<< v  << std::endl;
      flag = 0;
      break;
    }
    t = t + 0.1;
  }
  if (flag)
    std::cout << "not over speed" << std::endl;
}
